-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decouple Konnected entity setup from discovery #16146
Conversation
This looks like a lot of changes, but it's really mostly moving code around and some simplification. I've split up the |
Great news! I've had to downgrade to an earlier version of the konnected mcu firmware because of this issue. My system was repeatedly getting into an unrecoverable unresponsive state, when restarting Hass after editing config. |
* decouple entity setup from discovery * validate that device_id is a full MAC address
@heythisisnate - So my python is weak but does this mean I no longer need to use discovery w/ konnected ? |
@johntdyer No, not quite. Discovery is still required for the devices to be fully set up and connected to Hass. This change is one step in that direction, allowing the entities to be created ahead of time before the device's network information is discovered. I plan on adding a manual IP configuration option in a future release. |
@heythisisnate you should implement a config flow that will do discovery once and store the IP in a config entry |
@balloob Thank you for the suggestion. I didn't think it was possible for Hass to write to a config entry. Could you point me to an example of this or some documentation? |
And now let's no longer abuse this PR as a discussion place. You can find us on Discord. |
* decouple entity setup from discovery * validate that device_id is a full MAC address
Description:
This PR does not contain any new features or functional changes. It decouples Konnected entity setup from the network discovery process to improve stability and faster recovery in case of a Hass reboot or power failure.
Previously, the Konnected component would completely depend on
discovery
to find the Konnected device(s) on the network before the corresponding Hass entities (binary sensors & switches) were created. This caused a problem if Hass was rebooted while Konnected was still running -- Hass would "forget" all the discovered entities and the Konnected device could get into a reboot/failsafe cycle trying to update the states of devices that Hass didn't know about any longer. The reboot cycle prevented discovery from working again properly.Included in this PR, we decouple the entity setup from discovery so that entity setup happens earlier when the
konnected
component first loads. This allows the Konnected device(s) to recover quickly after a reboot and update states even if the device hasn't been re-discovered yet. Once discovery occurs, the entity will be augmented with its initial state and network information.Pull request in home-assistant.github.io with documentation: home-assistant/home-assistant.io#6066
Checklist:
tox
. Your PR cannot be merged unless tests pass